import 'package:flutter_test/flutter_test.dart';

import 'package:flutter_dio_plus/flutter_dio_plus.dart';

import 'test_model.dart';

void main() {
  test('example test', () async {
    logger.d('测试日志输出');
    // await showToast('测试消息提示');
    HttpUtil.initialization(
      DioConfig(
        logger: true,
        baseOptions: BaseOptions(
          baseUrl: 'https://tback.ice980.com/api',
          receiveTimeout: const Duration(seconds: 60),
          connectTimeout: const Duration(seconds: 60),
          sendTimeout: const Duration(seconds: 60),
        ),
        unauthorizedHandler: () {
          print('未授权处理');
        },
        refreshTokenStatusCodes: [402],
        refreshTokenRequest: () async {
          print('刷新token请求');
          await Future.delayed(const Duration(seconds: 2));
        },
      ),
    );

    var res = await getLIST<ListEntity>(
        '/base/tableColumn/list',
        {
          "tableCode": "user_manage",
        },
        serialize: ListEntity.fromJson);
    print('执行了吗');
    print(res.data);

    // var res2 = await getJSON<ResultEntity>('/base/language/common', {"tableCode": "user_manage"}, serialize: ResultEntity.fromJson);
    // print(res2.data.loginTips_3);

    // var res3 = await getPAGE<PageEntity>('/base/basic/tableColumn/page', {"pageNum": 1, "pageSize": 20}, serialize: PageEntity.fromJson);
    // print(res3.data.list.first.menuName);
  });
}
